Migrations are enabled for context, but the database does not exist or contains no mapped tables. Use Migrations to create the database and its tables, for example by running the 'Update-Database' command from the Package Manager Console.
The database is not getting created for the first time while running the asp.net mvc application. I got this above error migrations are enabled for context and use migration to create the database and its table.
Solution:
You can solve it manually via SQL management Studio by running the Database schema.
Run the following command in the nuget package manager console.
PM> Update-Database –Script
This will generate a SQL file with Schema code. Create an empty database and run the database schema, tables get created on it.
Post your comments / questions
Recent Article
- FieldError: Cannot resolve keyword 'id' into field in Django project
- How to hide the ID field from the Django admin?
- It is impossible to add a non nullable field without specifying a default. Django error
- ImportError: cannot import name 'url' from 'django.conf.urls' - Django Error
- How to Enable Virtualization in BIOS Security Settings in Intel Processors For Android Studio?
- Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it.
- AttributeError: 'NoneType' object has no attribute 'get_text' - Python
- ModuleNotFoundError: No module named 'openpyxl' - Python
Related Article